package com.ruoyi.web.wrapper;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.account.enums.ActionTypeEnum;
import com.ruoyi.common.wrapper.BaseControllerWrapper;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class AccountInfoHisWrapper extends BaseControllerWrapper {

    public AccountInfoHisWrapper(Map<String, Object> single) {
        super(single);
    }

    public AccountInfoHisWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    @Override
    public void wrapTheMap(Map<String, Object> map) {

        try {
            //处理时间
            SimpleDateFormat sdfCreateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date createTime = (Date)map.get("createTime");
            if (createTime != null){
                String strDate3 = sdfCreateTime.format(createTime);
                map.put("createTimeStr",strDate3);
            }
            //操作类型
            String actionType = (String) map.get("actionType");
            if (StrUtil.isNotEmpty(actionType)){
                map.put("actionTypeStr", ActionTypeEnum.getNameByValue(actionType));
            }



        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
